package entities;

// Generated Jul 11, 2014 8:05:43 PM by Hibernate Tools 3.4.0.CR1

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 * Categoria generated by hbm2java
 */
@Entity
@Table(name = "CATEGORIA", schema = "USER2")
public class Categoria implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -9074439989125159043L;

	@Id
	@Column(name = "CAT_ID", unique = true, nullable = false)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "idCategoriaSeq")
	@SequenceGenerator(name = "idCategoriaSeq", sequenceName = "idCategoriaseq")
	private int catId;

	@Column(name = "CAT_DESC", length = 100)
	private String catDesc;

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "CAT_PADRE", nullable = true)
	private Categoria catPadre;

	@OneToMany(fetch = FetchType.LAZY, mappedBy="catPadre")
	private Set<Categoria> subCategorias = new HashSet<Categoria>();

	public Categoria() {
	}

	public Categoria(int catId) {
		this.catId = catId;
	}

	public Categoria(int catId, String catDesc) {
		this.catId = catId;
		this.catDesc = catDesc;
	}

	public int getCatId() {
		return this.catId;
	}

	public void setCatId(int catId) {
		this.catId = catId;
	}

	public String getCatDesc() {
		return this.catDesc;
	}

	public void setCatDesc(String catDesc) {
		this.catDesc = catDesc;
	}

	public Categoria getCatPadre() {
		return this.catPadre;
	}

	public void setCatPadre(Categoria catPadre) {
		this.catPadre = catPadre;
	}
	
	public Set<Categoria> getSubCategorias() {
		return subCategorias;
	}

	public void setSubCategorias(Set<Categoria> subCategorias) {
		this.subCategorias = subCategorias;
	}

}
